package com.learn.sunday.stock.study;

import java.util.*;

public class Solution {

    public int[] twoSum(int[] nums, int target) {

        Map<Integer,List<Integer>> map = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {

            if (nums[i]>= target) {
                continue;
            }
            if (map.containsKey(nums[i])) {
                map.get(nums[i]).add(i);
            } else {
                ArrayList<Integer> objects = new ArrayList<>();
                objects.add(i);
                map.put(nums[i],objects);
            }
        }

        for (int i = 0; i < nums.length; i++) {
            if (nums[i]>= target) {
                continue;
            }
            if (map.containsKey(target - nums[i])) {
                if (nums[i] != target - nums[i]) {
                    return new int[]{i,map.get(target - nums[i]).get(0)};
                } else {
                    if (map.get(target - nums[i]).size() >= 2) {
                        return new int[]{map.get(target - nums[i]).get(0),map.get(target - nums[i]).get(1)};
                    }
                }
            } else {
                continue;
            }
        }
        return new int[]{-1,-1};

    }

    public int countOfPairs(int[] nums) {

        int[] paris = new int[nums.length];
        for (int i = 0; i < nums.length; i++) {
            paris[i] = nums[i];
        }
        return 0;

    }


    public static void main(String[] args) {

        int[] nums = new int[]{2, 3, 2};


        int max = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] >= max) {
                max = nums[i];
            }
        }

        int[][] graph = new int[nums.length][max + 1];
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < max + 1; j++) {
                if (nums[i] >= j) {
                    graph[i][j] = j;
                } else {
                    graph[i][j] = 0;
                }

            }
        }
        System.out.println(Arrays.toString(graph));

        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < max + 1; j++) {

                for (int k = 0; k < max + 1; k++) {

                    if (graph[i][j] <= graph[i+1][j]) {

                    }
                }

            }
        }
    }
}
